package com.android.tea;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;

import com.android.tea.adapter.AllFriendsAdapter;
import com.android.tea.entity.TeaMember;
import com.android.tea.entity.TeaMember.MemberType;

public class AllFriendsActivity extends Activity {
	
	private ListView listView;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.allfriends);
		initComponents();
	}

	private void initComponents() {
		listView = (ListView)findViewById(R.id.listView1);
		
		AllFriendsAdapter adapter = new AllFriendsAdapter(this, loadData());
		listView.setAdapter(adapter);
		
	}
	
	private List<TeaMember> loadData() {
		List<TeaMember> list = new ArrayList<TeaMember>();
		TeaMember member4 = new TeaMember();
		member4.setTitle("善良的灰太狼");
		member4.setType(MemberType.TeaCommon);
		member4.setTimeStamp(System.currentTimeMillis());
		list.add(member4);

		TeaMember member = new TeaMember();
		member.setTitle("茶百科团队");
		member.setType(MemberType.TeaTeam);
		member.setTimeStamp(System.currentTimeMillis());
		list.add(member);

		TeaMember member1 = new TeaMember();
		member1.setTitle("新闻资讯");
		member1.setType(MemberType.TeaNews);
		member1.setTimeStamp(System.currentTimeMillis());
		list.add(member1);

		TeaMember member2 = new TeaMember();
		member2.setTitle("茶友半月刊");
		member2.setType(MemberType.TeaBooks);
		member2.setTimeStamp(System.currentTimeMillis());
		list.add(member2);

		TeaMember member3 = new TeaMember();
		member3.setTitle("供求信息");
		member3.setType(MemberType.TeaSupplyDemand);
		member3.setTimeStamp(System.currentTimeMillis());
		list.add(member3);

		TeaMember member5 = new TeaMember();
		member5.setTitle("天上人间");
		member5.setType(MemberType.TeaShop);
		member5.setTimeStamp(System.currentTimeMillis());
		list.add(member5);

		return list;
	}

}
